FROM golang:1.22.2 as build

WORKDIR /app
COPY . /app

ENV CGO_ENABLED=0
ENV GOOS=linux
RUN cd /app/cmd && go build -o ../bin/server

FROM gcr.io/distroless/base-debian12

WORKDIR /app

COPY --from=build /app/bin/server /app/server

ENV SERVER_PORT=8088
ENV SERVER_PG_URL=postgres://postgres:postgres@localhost:5432/postgres

EXPOSE 8088

CMD [ "/app/server" ]
